<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/decorators/taglibs.jsp"%>
<div class="w1a">    
<table id="dg" class="easyui-treegrid" url="${appPath}/sessionBrowse/list.json" align="center" 
	singleSelect="true" striped="true" title="會期查詢" width="900px" rownumbers="false" idField="id" treeField="text">
	<thead>      
    	<tr>   
            <th field="text" width="300px">委員會議電子書瀏覽</th>
            <th field="name" width="200px" formatter="actionFmt">功能</th>
		</tr>   
	</thead>   
</table> 
</div>
<script type="text/javascript">
$.ajaxSetup ({
    cache: false,
    async:false
});
$(function() {
});
function actionFmt(val,row,ix){ var str = "";
	if(val!=null && val !=''){
		<sec:authorize ifAnyGranted="admin,subAdmin">
		str = str.concat("[<a target='_p' href='${appPath}/motionView/"+val+".htm'>目次表</a>]");
		</sec:authorize>
		<sec:authorize ifAnyGranted="imgUser">
		$.ajax({url:"${appPath}/sessionView/isOpen/"+val+".json", 
			async:false ,cache:false, success:function(d){ 
				if(eval(d)){
					str = str.concat("[<a target='_p' href='${appPath}/motionView/"+val+".htm'>目次表</a>]");
				}else{
					str = str.concat("[尚未開放]");
				}
			}
		});			
		</sec:authorize>
	}
return str; 
} 
function doSearch(){ var object = {};
	$.each($('#searchForm').serializeArray(), function(i, v) { object[v.name] = v.value; });
	$('#dg').datagrid('load', object ); 
} 

function fmClean(){$("#searchForm").form('reset');}

</script>